import React from 'react'
import { Link, withRouter } from 'react-router-dom'
import './index.scss'

class Header extends React.Component {
  render() {
    const { title, left, right, history } = this.props
    return (
      <div className="Head_top">
        {left === 'search' ? (
          <Link className="link_search" to="/search">
            <span className="iconfont iconsousuo"></span>
          </Link>
        ) : left === 'string' ? (
          <div className="head_logo">ele.me</div>
        ) : (
          <div
            onClick={() => {
              history.go(-1)
            }}
            className="link_search"
          >
            <span className="iconfont iconfanhui"></span>
          </div>
        )}
        <Link className="msite_title" to="/">
          {title}
        </Link>
        {right === true && (
          <Link className="head_login" to="/login">
            登录|注册
          </Link>
        )}
      </div>
    )
  }
}
export default withRouter(Header)
